package cn.sczhyt.modules.szhy.controller;

import java.util.Arrays;
import java.util.Map;

import cn.sczhyt.common.utils.PageUtils;
import cn.sczhyt.common.utils.R;
import io.swagger.annotations.Api;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.sczhyt.modules.szhy.entity.MeetingReceiverEntity;
import cn.sczhyt.modules.szhy.service.MeetingReceiverService;



/**
 * 会议签收登记表
 *
 * @author luoshijie
 * @email 1169414426@qq.com
 * @date 2020-09-03 15:15:15
 */
@RestController
@RequestMapping("szhy/meetingreceiver")
public class MeetingReceiverController {
    @Autowired
    private MeetingReceiverService meetingReceiverService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("szhy:meetingreceiver:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = meetingReceiverService.queryPage(params);

        return R.ok().put("page", page);
    }
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("szhy:meetingreceiver:info")
    public R info(@PathVariable("id") String id){
		MeetingReceiverEntity meetingReceiver = meetingReceiverService.getById(id);

        return R.ok().put("meetingReceiver", meetingReceiver);
    }

    /**
     * 保存参会人员
     */
    @RequestMapping("/save")
    @RequiresPermissions("szhy:meetingreceiver:save")
    public R save(@RequestParam String meetingId,@RequestParam String userIds){
//		meetingReceiverService.saveReceiver(meetingId,userIds);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("szhy:meetingreceiver:update")
    public R update(@RequestBody MeetingReceiverEntity meetingReceiver){
		meetingReceiverService.updateById(meetingReceiver);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("szhy:meetingreceiver:delete")
    public R delete(@RequestBody String[] ids){
		meetingReceiverService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
